Three Steps for the CPS Transformation

نویسنده

  • Olivier Danvy
چکیده

Transforming a λ-term into continuation-passing style (CPS) might seem mystical at first, but in fact it can be characterized by three separate aspects: • The values of all intermediate applications are given a name. • The evaluation of these applications is sequentialized based on a traversal of their syntax tree. This traversal mimics the reduction strategy. • The resulting term is equipped with a continuation — a λ-abstraction whose application to intermediate values yields the final result of the whole evaluation. The first point is fulfilled using the uniform naming mechanism of λ-abstraction (Church encoding), which explains why continuations are represented as functions. The second point justifies why CPS terms are evaluation-order independent — their evaluation order is determined by the syntax tree traversal of the CPS transformation. The third point captures the essence of the CPS transformation. We have staged Fischer and Plotkin’s original CPS transformer according to the three points above. For call-by-value λ-terms, the tree traversal is post-order. The method is applicable to other evaluation orders, e.g., call-by-value with evaluation from right to left, or call-by-name. This staging originates in the need for a clearer formulation of the CPS transformation, suitable for deriving its inverse.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Thunks (Continued)

Call-by-name can be simulated in a call-by-value setting using \thunks" (i.e., parameterless procedures) or continuation-passing-style (CPS). In this paper we uncover a relationship between the two simulations. We prove that the call-by-value CPS transformation Cv, when applied to a term T (t) which simulates call-by-name using thunks, yields a term identical to the call-by-name CPS transformat...

متن کامل

Call-by-Need and Continuation-Passing Style

This paper examines the transformation of call-by-need terms into continuation passing style (CPS). It begins by presenting a simple transformation of call-by-need terms into program graphs and a reducer for such graphs. From this, an informal derivation is carried out, resulting in a translation from terms into self-reducing program graphs, where the graphs are represented as CPS terms involvi...

متن کامل

Influence of aging temperature on phase transformation and mechanical behavior of NiTi thin films deposited by magnetron sputtering technique

In this study, NiTi thin films were deposited on the glass and NaCl substrates by means of magnetron sputtering method. The influence of aging temperature, over the range 300-500 oC, on phase transformation and mechanical properties of the sputtered NiTi thin films were studied by differential scanning calorimetry (DSC) and nano-indentation assay, respectively. The DSC curves showed that the ag...

متن کامل

A !rst-order one-pass CPS transformation

We present a new transformation of -terms into continuation-passing style (CPS). This transformation operates in one pass and is both compositional and !rst-order. Previous CPS transformations only enjoyed two out of the three properties of being !rst-order, one-pass, and compositional, but the new transformation enjoys all three properties. It is proved correct directly by structural induction...

متن کامل

CPS transformation of flow information , Part II : administrative reductions ∗ DANIEL

We characterize the impact of a linear β-reduction on the result of a control-flow analysis. (By ‘a linear β-reduction’ we mean the β-reduction of a linear λ-abstraction, i.e., of a λabstraction whose parameter occurs exactly once in its body.) As a corollary, we consider the administrative reductions of a Plotkin-style transformation into Continuation-Passing Style (CPS), and how they affect t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1991